public class hanoi2 {
    public static void hanoi(int n, char source, char auxiliary, char target) {
        if (n == 1) {
            System.out.println("将圆盘 1 从 " + source + " 移动到 " + target);
        } else {
            hanoi(n - 1, source, target, auxiliary);
            System.out.println("将圆盘 " + n + " 从 " + source + " 移动到 " + target);
            hanoi(n - 1, auxiliary, source, target);
        }
    }

    public static void main(String[] args) {
        int n = 3;
        hanoi(n, 'A', 'B', 'C');
    }
}
